/**
 * Copyright (C), 2019-2020, 宇信融汇
 * FileName: GenericTest2
 * Author:   666
 * Date:     2020/8/3 23:19
 * Description:
 * History:
 * <author>          <time>          <version>          <desc>
 * 666           修改时间           版本号              描述
 */
package c_010.generic;

import org.junit.Test;

import java.util.ArrayList;
import java.util.List;

/**
 * @Classname GenericTest2
 * @Description TODO
 * @Date 2020/8/3 23:19
 * @Created by 666
 */
public class GenericTest2 {
    @Test
    public void test() {
        //具备子父类关系
        Object o = null;
        Integer i = null;
        o = i;


        Object[] obj = null;
        String[] str = null;
        obj = null;


        ArrayList<Object> arrayList = null;
        ArrayList<Integer> integerList = null;
        //不具有子父类关系
        //  arrayList = integerList;
    }

    @Test
    public void test1() {
        List<? extends Person> list1 = null;
        List<? super Person> list2 = null;

        List<Student> list3 = new ArrayList<Student>();
        List<Person> list4 = new ArrayList<Person>();
        List<Object> list5 = new ArrayList<Object>();

//        list1 = list3;
//        list1 = list4;
//      //  list1 = list5;
//
////        list2 = list3;
//        list2 = list4;
//        list2 = list5;
//
//        list1 = list4;
//        Object person = list1.get(0);
//
//        list2 = list4;
//        Object o = list2.get(0);


        //写入
        //list1.add(new Student());

        list2.add(new Student());
        list2.add(new Person());
        //list2.add(new Object());



    }

}
